<style>
    .table thead tr th,.table tbody tr td,.table tbody tr th{
        text-align: center;
    }
</style>
<div id="content">
    <!-- <link href="/media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet"> -->
    <script src="/media/vendor/js/jquery-1.10.2.js"></script> 
    <script src="/media/js/leadtime/skusalesshow.js"></script> 
    <script src="/media/js/highcharts.js"></script> 
    <!-- <script src="/media/vendor/js/jquery-ui-1.10.4.custom.js"></script> 
    <script src="/media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script> 
    <script src="/media/vendor/artdialog/jquery.artDialog.js"></script>
    <link rel="stylesheet" href="/media/vendor/artdialog/skins/default.css" type="text/css" media="all">
    <script src="/media/vendor/artdialog/jquery.artDialog.js"></script> 
    <script src="/media/js/jquery.json-2.4.js"></script> -->
    <div id="formSearch" class="form-horizontal">
        <form action="/skusalesshow" method="GET" style="display: inline-block">
            <div style="margin-bottom:10px; display: inline-block;">
                <span class="asd" for="input01">sku</span>
                <input style=" width:150px; margin-right:10px;" type="text" placeholder="准确SKU" class="input-xlarge sku" name="skuName" autocomplete="off" value="<?php echo htmlspecialchars(isset($_GET['skuName']) ? $_GET['skuName'] : '', ENT_QUOTES, 'UTF-8'); ?>">
                <input style=" width:164px; margin-right:10px;" type="text" placeholder="模糊匹配" class="input-xlarge skuLike" name="skuNameLike" autocomplete="off" value="<?php echo htmlspecialchars(isset($_GET['skuNameLike']) ? $_GET['skuNameLike'] : '', ENT_QUOTES, 'UTF-8'); ?>">
                <span class="asd" for="input01">负责人</span><input style=" width:150px; margin-right:10px;" type="text" name="username" value="<?php echo isset($get['username'])?$get['username']:$opera; ?>">
                <label style="display: inherit;">
                    分平台查询
                    <input type="checkbox" class="input-xlarge" name="allStage" value="F" <?php echo empty($_GET['allStage']) ? '' : 'checked'; ?>>
                </label>
            </div>
            <div style="margin-bottom:10px; display: inline-block;">
                <button style="margin-left:10px;" class="btn btn-info" type="submit">查询</button>
                <button class="btn btn-inverse" type="reset">重置</button>
            </div>
        </form>
        <button class="btn btn-success" onclick="skusalesshowObj.download()">下载</button>
        <label>最后更新时间：<?php echo $last;?></label>
        <div id="container"></div>
        <?php 
        if( isset($dataList) ) {
        ?>
            <table id="paging" class="table table-hover ">
                <thead>
                    <tr style=" background-color:#4EA392; color:#fff;">
                        <th> SKU </th>
                        <th> 商品名 </th>
                        <th> 预计明日销量 </th>
                        <th> 7日内均销量 </th>
                        <th> 14日内均销量 </th>
                        <th> 28日内均销量 </th>
                        <th> 销售平台 </th>
                        <th> 查看走势 </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $cacheSku = array();
                    foreach($dataList as &$v) {
                        $cacheSku[$v['sku']] = &$v['sku'];
                    }
                    $temp = json_decode(skusystemapi::getMoreSkuCnname('("' . join('", "', $cacheSku)  . '")'), true);  //无可奈何的写法
                    $cacheSku = array();
                    if( $temp ) {
                        foreach($temp as &$v) $cacheSku[$v['sku']] = &$v['name'];
                    }

                    foreach($dataList as $k => &$v) {
                        if( empty($_GET['allStage']) ) {
                            $v['stage'] = 0;
                            $temp = '全平台';
                        } else {
                            switch( $v['stage'] ) {
                                case '1':
                                    $temp = 'ebay';
                                    break;
                                case '2':
                                    $temp = '速卖通';
                                    break;
                                case '3':
                                    $temp = '亚马逊';
                                    break;
                                case '4':
                                    $temp = 'wish';
                                    break;
                            }
                        }

                        echo "<tr>
                            <td> {$v['sku']} </td>
                            <td> {$cacheSku[$v['sku']]} </td>
                            <td> {$v['daysale']} </td>
                            <td> {$v['daysale7']} </td>
                            <td> {$v['daysale14']} </td>
                            <td> {$v['daysale28']} </td>
                            <td> {$temp} </td>
                            <th> <a href='#' onclick='skusalesshowObj.showChart(\"{$v['sku']}\", \"{$v['stage']}\"); return false;'>查看</a> </th>
                        </tr>";
                    }
                    ?>
                </tbody>
            </table>
        <?php
            echo $pagination;
        }
        ?>
    </div>
</div>